package com.HospitalOutpatient.dao;

import com.HospitalOutpatient.entity.Doctor;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DoctorDao {

    @Select("select * from doctor where doctorId = #{doctorId}")
    Doctor selectDoctorById(String doctorId);
    List<Doctor> selectAllDoctorByName(String doctorName);

    @Update("update doctor set doctorName = #{doctorName}," +
            " position = #{position}, " +
            "introduction = #{introduction}, " +
            "charge = #{charge}," +
            "outpatientId = #{outpatientId}" +
            "where doctorId = #{doctorId}")
    int updateDoctor(Doctor doctor);

    @Delete("delete from doctor where doctorId = #{doctorId}")
    int deleteDoctor(String doctorId);

    @Insert("insert into doctor values (null,#{doctorName},#{introduction},#{position},#{charge},#{outpatientId},#{userId})")
    int insertDoctor(Doctor doctor);

    @Select("select * from doctor where userId = #{userId}")
    Doctor selectDoctorByUserId(String userId);

}
